module.exports = {
  apps: [
    {
      name: "app",
      script: "app.js"
    }
  ],
  deploy: {
    // "production" is the environment name
    api: {
      // SSH key path, default to $HOME/.ssh
      // SSH user
      user: "root",
      // SSH host
      host: ["182.254.243.206"],
      // GIT remote/branch
      ref: "origin/master",
      // GIT remote
      repo: "git@gitlab.com:qq986171791/eh-ng-faya.git",
      // path in the server
      path: "/var/www/eh-ng-faya-api",
      "pre-setup": "rm -rf /var/www/eh-ng-faya-api",
      "post-setup":
        "cd /var/www/eh-ng-faya-api/current/api && rm -rf node_modules && yarn",
      // post-deploy action
      "post-deploy":
        "cd /var/www/eh-ng-faya-api/current/api && pm2 start yarn --name api -- run prod:api &&  pm2 start yarn --name napi -- run prod:napi"
    },
    www: {
      // SSH key path, default to $HOME/.ssh
      // SSH user
      user: "root",
      // SSH host
      host: ["182.254.243.206"],
      // GIT remote/branch
      ref: "origin/master",
      // GIT remote
      repo: "git@gitlab.com:qq986171791/eh-ng-faya.git",
      // path in the server
      path: "/var/www/eh-ng-faya-www",
      "pre-setup": "rm -rf /var/www/eh-ng-faya-www",
      // post-deploy action
      "post-deploy":
        "cd /var/www/eh-ng-faya-www/current && pm2 serve ./dist/browser --port 4200 --name eh-ng-faya-web"
    }
  }
};
